package day14.pack2;

import day14.Student;

import java.util.HashSet;
import java.util.Iterator;

public class TestHashSet {
    public static void main(String[] args) {
        // 无序,不可重复
        // hashcode ,equals
        HashSet<Student> set = new HashSet<>();
        Student stu1 = new Student(9527, "张恺");
        Student stu2 = new Student(9527, "张恺");
        set.add(stu1);
        set.add(stu2);
        Iterator<Student> iterator = set.iterator();
        while(iterator.hasNext()) {
            System.out.println(iterator.next());
        }
        System.out.println(stu1.equals(stu2));
        System.out.println(set.size());
    }
}
